<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div>
       <canvas id="triangle"></canvas>
    </div>
    <script>
       var canvas = document.getElementById('triangle');
       var context = canvas.getContext("2d");
       context.strokeStyle = "blue";
       context.lineWidth = 6;
       context.moveTo(110, 10);
       context.lineTo(160, 60);
       context.lineTo(60, 60);
       context.lineTo(110, 10);
       context.lineTo(160, 60);//多画一条边，解决锯齿
       context.stroke()
    </script>
</body>
</html>